package com.hero.tweaks.service;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.IBinder;
import android.preference.PreferenceManager;

import com.hero.tweaks.util.Constants;

public class BootService extends Service implements Constants {
	class BootWorker extends AsyncTask<Void, Void, Void> {
		Context c;

		public BootWorker(Context c) {
			this.c = c;
		}

		@SuppressWarnings("deprecation")
		@Override
		protected Void doInBackground(Void... args) {

			SharedPreferences preferences = PreferenceManager
					.getDefaultSharedPreferences(c);
			return null;
		}

		@Override
		protected void onPostExecute(Void result) {
			super.onPostExecute(result);
			servicesStarted = true;
			stopSelf();
		}
	}

	public static boolean servicesStarted = false;

	Context context;

	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
	}

	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		context = this;
		if (intent == null) {
			stopSelf();
		}
		new BootWorker(this).execute();
		return START_STICKY;
	}
}
